<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Roles extends Model
{
    protected $fillable = ['role_name', 'remark', 'status'];

    /**
     * 反向关联   角色对应管理员
     * Author: 陈坤
     * Date: 2019/1/18 18:21
     */
    public function admin()
    {
        return $this->belongsToMany('App\Models\Admins', 'admin_roles', 'role_id', 'admin_id');
    }


    /**
     * 反向关联   角色对应权限
     * Author: 陈坤
     * Date: 2019/1/18 18:21
     */
    public function permission()
    {
        return $this->belongsToMany('App\Models\Permissions', 'role_permissions', 'role_id', 'permission_id');
    }

}
